# Contributor: Nicolas Lorin <androw95220@gmail.com>
# Maintainer: Nicolas Lorin <androw95220@gmail.com>
pkgname=rio
pkgver=0.0.36
pkgrel=0
pkgdesc="A hardware-accelerated GPU terminal emulator powered by WebGPU, focusing to run in desktops and browsers."
url="https://raphamorim.io/rio"
arch="all !s390x"
license="MIT"
# !check: no tests available
# net: required to fetch rust dependencies
options="!check net"
depends="$pkgname-terminfo"
makedepends="cargo cargo-auditable cmake expat-dev freetype-dev fontconfig-dev libxcb-dev ncurses python3"
subpackages="$pkgname-terminfo"
source="$pkgname-$pkgver.tar.gz::https://github.com/raphamorim/rio/archive/refs/tags/v$pkgver.tar.gz"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen --no-default-features --features=x11,wayland
	tic -e rio -x -o terminfo misc/rio.terminfo
}

package() {
	install -Dm755 target/release/rio "$pkgdir"/usr/bin/rio
	install -Dm644 terminfo/r/rio "$pkgdir"/usr/share/terminfo/r/rio

	# Install desktop files
	install -Dm644 misc/rio.desktop -t "$pkgdir"/usr/share/applications
	install -Dm644 misc/logo.svg \
		"$pkgdir"/usr/share/icons/hicolor/scalable/apps/rio.svg
}

terminfo() {
	amove usr/share/terminfo
}

sha512sums="
a1657d65c7a0c24d8dc481347a22981ef7fd7410613ae47e3ad740f93993047fad2365f7fbb209bd1abade76aa3924bcde193755b0249e7f554ca1490b094600  rio-0.0.36.tar.gz
"
